package com.lhf.sparecost.controller;


import com.lhf.sparecost.model.SpareClassQueryVo;
import com.lhf.sparecost.model.SpareCostAddVo;
import com.lhf.sparecost.model.SpareCostSelectVo;
import com.lhf.sparecost.service.SpareCostService;
import com.lhf.util.ResultVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * @author 尐痞猫
 * @date2021-06-25 22:48
 */
@RestController
@CrossOrigin
public class SpareCostController {

    @Autowired
    private SpareCostService spareCostService;

    //根据法人查询工厂下拉栏
    @GetMapping("/materialCostPrice/queryFactorys")
    public ResultVo queryFactorys(String legalPersonCode) {
        return spareCostService.queryFactorys(legalPersonCode);
    }
    //查询含税类型下拉栏
    @GetMapping("/materialCostPrice/queryAllTaxType")
    public ResultVo queryAllTaxType() {
        return spareCostService.queryAllTaxType();
    }
    //所有其他类型下拉栏
    @PostMapping("/materialCostPrice/getPullDownList")
    public ResultVo getPullDownList(){
        return spareCostService.getPullDownList();
    }
    //成本价分页查询
    @PostMapping("/materialCostPrice/queryPage")
    public ResultVo queryPage(@RequestBody SpareCostSelectVo spareCostSelectVo){
        return spareCostService.queryPage(spareCostSelectVo);
    }
    //备件分页查询
    @PostMapping("/materialCostPrice/queryspareClass")
    public ResultVo queryspareClass(@RequestBody SpareClassQueryVo spareClassQueryVo){
        return spareCostService.queryspareClass(spareClassQueryVo);
    }

    //新增
    @PostMapping("/materialCostPrice/add")
    public ResultVo add(@RequestBody @Valid SpareCostAddVo spareCostAddVo){
        return spareCostService.add(spareCostAddVo);
    }

}
